import React from 'react';
import CommonPage from '@/components/page/CommonPage';
const daoName = 'Zbzl';
const importName = 'Zbzl';
const columns: API.Column[] = [
  {
    title: '部门',
    width: 110,
    sorter: true,
    key: 'DPNM',
    dataIndex: 'DPNM',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '指标名称',
    width: 150,
    sorter: true,
    key: 'ZBMC',
    dataIndex: 'ZBMC',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '基数',
    width: 110,
    sorter: true,
    key: 'JS',
    dataIndex: 'JS',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '计划增量',
    width: 110,
    sorter: true,
    key: 'JHZL',
    dataIndex: 'JHZL',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '完成量',
    width: 110,
    sorter: true,
    key: 'WCL',
    dataIndex: 'WCL',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '完整增量',
    width: 110,
    sorter: true,
    key: 'WCZL',
    dataIndex: 'WCZL',
    dispaly: true,
    filter: true,
    export: true,
  },
  {
    title: '增量完成率',
    width: 110,
    sorter: true,
    key: 'WCLV',
    dataIndex: 'WCLV',
    dispaly: true,
    filter: true,
    export: true,
  },
];

const controlsImport: API.Control[] = [
  { name: 'DPNM', type: 'text', label: '部门', grid: 12 / 24 },
  { name: 'JS', dataType: 'number', label: '基数', grid: 12 / 24 },
  {
    name: 'DFJD',
    dataType: 'date',
    type: 'quarter',
    label: '选择季度',
    rules: [{ required: true, message: '季度不能为空' }],
    grid: 12 / 24,
  },
  {
    name: 'ZBID',
    label: '选择指标',
    type: 'tree-select',
    grid: 12 / 24,
    rules: [{ required: true, message: '指标不能为空' }],
    dataType: 'number',
    fetch: {
      tableName: 'ShJhcwDcSetJYDW',
      optionTpl: 'ZBMC',
      valueTpl: 'ZBID',
      isDao: true,
      where: '"ISDF" = 0',
    },
  },
  {
    name: 'JHZL',
    rules: [{ required: true }],
    type: 'number',
    label: '计划增量',
    grid: 12 / 24,
    dataType: 'number',
  },
  {
    name: 'WCL',
    rules: [{ required: true }],
    type: 'number',
    label: '完成量',
    grid: 12 / 24,
    dataType: 'number',
  },
  {
    name: 'WCZL',
    rules: [{ required: true }],
    type: 'number',
    label: '完成增量',
    grid: 12 / 24,
    dataType: 'number',
  },
  {
    name: 'WCLV',
    rules: [{ required: true }],
    type: 'number',
    label: '增量完成率',
    grid: 12 / 24,
    dataType: 'number',
  },
];

const controls: API.Control[] = [
  { name: 'DPNM', type: 'text', label: '部门', grid: 12 / 24 },
  { name: 'ZBMC', type: 'text', label: '指标名称', grid: 12 / 24 },
  { name: 'JS', dataType: 'number', label: '基数', grid: 12 / 24 },
  {
    name: 'JHZL',
    rules: [{ required: true }],
    type: 'number',
    label: '计划增量',
    grid: 12 / 24,
    dataType: 'number',
  },
  {
    name: 'WCL',
    rules: [{ required: true }],
    type: 'number',
    label: '完成量',
    grid: 12 / 24,
    dataType: 'number',
  },
  {
    name: 'WCZL',
    rules: [{ required: true }],
    type: 'number',
    label: '完成增量',
    grid: 12 / 24,
    dataType: 'number',
  },
  {
    name: 'WCLV',
    rules: [{ required: true }],
    type: 'number',
    label: '增量完成率',
    grid: 12 / 24,
    dataType: 'number',
  },
];

const Zbzl: React.FC = () => {
  return (
    <CommonPage
      daoName={daoName}
      columns={columns}
      controls={controls}
      title="指标增量"
      importName={importName}
      importControls={controlsImport}
      importParamNames={['DFJD', 'ZBID']}
      importMode="DeleteAfterInsert"
      importTemplateName="指标增量导入模板"
      keyColName="ID"
    />
  );
};
export default Zbzl;
